﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////

// Reviewed

#pragma once

#include "GcmpGUiBaseInterface.h"
#include "WeakReferenceable.h"

namespace gcmp
{
    enum class ControlDefinitionType : int32_t
    {
        UnKnow = -1,                 ///<  未知类型
        CommandButton = 0,           ///<  button
        CommandButtonMenu,          ///<  ButtonMenu
        CommandMenuItem,            ///<  ButtonMenu的叶子菜单
        Separator,                  ///<  菜单分割符
        ComboBox,                   ///<  下拉框
        Gallery,                   ///<  Gallery
        GalleryItem,              ///<  Gallery里的子控件
        LineEdit,                 ///<  输入框
        Label,                    ///<  label
        ProgressBar,              ///<  进度条
        CheckBoxGroup,            ///<  一组CheckBox
        CheckBox,                 ///<  CheckBox
        RadioButtonGroup,         ///<  一组RadioButton
        RadioButton               ///<  RadioButton
    };

    /// \brief 控件数据定义接口
    class GCMP_GUI_BASE_INTERFACE_EXPORT IControlDefinition : public WeakReferenceable
    {
    public:
        /// \brief 得到用户指定的字符串格式的控件唯一Id
        ///
        /// 需要保证唯一性
        virtual std::wstring GetId() const = 0;

        /// \brief 得到控件标题，或者菜单栏中的菜单名称
        virtual std::wstring GetCaption() const = 0;

        /// \brief 得到提示文字
        virtual std::wstring GetTooltip() const = 0;

        /// \brief 得到控件的可见性
        /// \return  返回true表示可见，返回false表示不可见
        virtual bool IsVisible() const = 0;

        /// \brief 得到控件的可用性
        /// \return  返回true表示可用，返回false表示不可用
        virtual bool IsEnabled() const = 0;

        /// \brief 获取控件定义类型
        /// \return 表示控件定义类型的枚举值
        virtual ControlDefinitionType GetType() const = 0;

        /// \brief 获取控件定义是否为引用
        static bool IsReference(const IControlDefinition*  pControlDefinition);
    };
}

